package QuestionNum_19_1;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class QuestionNum_19_1_hxj {
    public static void main(String[] args) {

        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("f");
        list.add("b");
        list.add("c");
        list.add("a");
        list.add("d");

        System.out.println(list);
        list = removeSame_hxj(list);
        System.out.println(list);
    }

    private static List<String> removeSame_hxj(List<String> list) {
        Set<String> set = new HashSet<>();
        set.addAll(list);
        List<String> listSingle = new ArrayList<>();
        for(String s : set){
            listSingle.add(s);
        }
        return listSingle;
    }
}
